package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Address;
import com.itheima.service.AddressService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/address")
public class AddressController {

    @Reference
    private AddressService addressService;

    @RequestMapping("/findAddress")

    public Result findAddress(){
        List<Address> addressList = addressService.findAll();
        if (addressList != null){
            return new Result(true,MessageConstant.QUERY_ADDRESS_SUCCESS,addressList);
        }
        return new Result(false, MessageConstant.QUERY_ADDRESS_FAIL);
    }
}
